<?php
    require_once "funciones.php";
    $link_caweb = con_caweb();
    $q=$_REQUEST["q"];
    
    $_SESSION['caweb']['oc']=$q;
    
    $result2 ="SELECT b.bodega,b.secuencia,a.transaccion,a.oc,a.proveedor,a.factura,a.estado,b.item,(b.cantidad-b.recibidas) AS saldo,c.nombre,tax.taxDesc,tax.codigotaxonomia
    FROM cabeceras_oc AS a
    INNER JOIN detalles_oc AS b
    ON a.transaccion = b.transaccion
    INNER JOIN proveedores AS c
    ON c.nit = a.proveedor
    left join intranetpccom.taxonomia tax on tax.codigotaxonomia = b.item
    WHERE a.estado='G' AND (b.cantidad-b.recibidas) > 0 AND a.oc='$q'";
    $result2= mysql_query($result2,$link_caweb) or die('Error cabeceras_oc, '.mysql_error());
    ?> 
    Cantidad / Raiz taxonomia: <select name="lectura" id="lectura" size="1" onchange="
    $('#cimo', window.frames['InlineFrame1'].document).hide();
    $('#prash', window.frames['InlineFrame1'].document).hide();
    $('#adita', window.frames['InlineFrame1'].document).hide();
    if(this.value != 'XXX')    top.frames['InlineFrame1'].location='slgrid/movimientos_eco.php?item='+this.value;">
    <option value='XXX' SELECTED>Seleccionar..</option>
    <?
    //echo  $result2;
    while($row2 = mysql_fetch_array($result2))
    {
        $mostrar = ($row2['taxDesc'] =="")?$row2['codigotaxonomia']:$row2['taxDesc'];
    ?>
        <option value="<? echo $row2[item]; ?>" >
          <? echo $row2["saldo"]." -> ".$mostrar; ?> </option>
    <? 
    }
    ?>
    </select>